# 构建阶段
FROM golang:1.24-alpine AS builder

# 设置工作目录
WORKDIR /app

# 安装基本工具
RUN apk add --no-cache git make

# 复制Go模块文件
COPY go.mod go.sum ./

# 下载依赖
RUN go mod download

# 复制源代码
COPY . .

# 构建
RUN go build -o /app/bin/connector-test ./cmd/connector-test

# 运行阶段
FROM alpine:latest

# 添加运行时依赖
RUN apk add --no-cache ca-certificates tzdata

# 设置时区为亚洲/上海
ENV TZ=Asia/Shanghai

# 复制执行文件
COPY --from=builder /app/bin/connector-test /usr/local/bin/

# 创建工作目录
WORKDIR /app

# 设置入口点
ENTRYPOINT ["connector-test"]

# 默认命令
CMD ["--help"] 